package cn.tedu.rabbitmqboot.m1;


import org.springframework.amqp.core.Queue;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

import javax.annotation.PostConstruct;

@SpringBootApplication
public class Main {

    public static void main(String[] args) {
        SpringApplication.run(Main.class, args);
    }
    @Bean
    public Queue helloworldQueue(){
        //spring默认是持久化的,false表示非持久
        return new Queue("helloworld",false);
    }
    @Autowired Producer p;
    @PostConstruct //在Spring执行完扫描,创建完所有的对象,完成注入后,自动执行PostConstruct方法
    public void test(){
        p.send();
    }
}

